﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GroupFunctions.ascx.cs"
    Inherits="Controls_BackEnd_GroupFunctions" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div id="content-outer">
            <div id="content" style="min-width: 100% !important; vertical-align: top; margin-top: -25px;">
                <div id="page-heading">
                    <h1>
                        <%=Resources.Resource.ListFunction %></h1>
                </div>
                <div style="float: left; width: 100%; ">
                    <table border="0" width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <fieldset>
                                    <legend><strong>
                                        <%=Resources.Resource.FindInfo %></strong></legend>
                                    <label style="float: left; width: 100px">
                                        <%=Resources.Resource.FindContent %>
                                    </label>
                                    <label style="float: left; width: 150px">
                                        <asp:TextBox ID="txtContent" runat="server"></asp:TextBox>
                                    </label>
                                    <label style="float: left; width: 200px">
                                        <asp:Button OnClick="AllCommand" ID="btnSearch" runat="server" Text="Search" /> <asp:Button OnClick="AllCommand" ID="btnAlow" OnClientClick="Accept();return false;" runat="server" Text="Accept" />
                                    </label>
                                </fieldset>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <fieldset>
                                    <legend><strong>
                                        <%=Resources.Resource.FindResult %></strong></legend>
                                    <br>
                                    <asp:GridView ID="grvData" class="listing" Style="width: 100% !important;" CellPadding="0"
                                        runat="server" AutoGenerateColumns="False" OnRowDataBound="grvData_RowDataBound">
                                        <Columns>
                                            <asp:TemplateField ItemStyle-Width="30px" HeaderStyle-Width="30px" HeaderText="ID"
                                                ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <%#Eval("FunctionID")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Name">
                                                <ItemTemplate>
                                                    <%#Eval("Name")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="40px" HeaderStyle-Width="40px"
                                                HeaderText="Select">
                                                <ItemTemplate>
                                                    <input id='<%#Eval("FunctionID") %>_cb' onclick="Check(this,'<%#Eval("FunctionID") %>');"
                                                        type="checkbox" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </fieldset>
                                <asp:HiddenField ID="HiddenField1" runat="server" />
                            </td>
                        </tr>

                        <script language="javascript" type="text/javascript">       
        Accept=function()
        {
          var list=$control('<%=HiddenField1.ClientID %>').value;  
        parent.AcceptFromPopup(list);
        } 
        Check=function(obj,id)
        {
        var list=$control('<%=HiddenField1.ClientID %>').value;      
        if(obj.checked)
        {        
        list+=list.length>0? "|"+id:id;
        $control('<%=HiddenField1.ClientID %>').value=list;
        return;
        }
          var arr=list.split('|');
          list='';          
          for(var index=0;index< arr.length;index++)
        {
            if(arr[index]!=id)
            list+=list.length>0? "|"+id:id;
        }
         $control('<%=HiddenField1.ClientID %>').value=list;
        }
        unloadwhenchange=function()
        {
        var list=$control('<%=HiddenField1.ClientID %>').value;
        if(list.length<1)return;
        var arr=list.split('|');
        for(var index=0;index< arr.length;index++)
        {
            if($control(arr[index]+'_cb') !=null)
            $control(arr[index]+'_cb').checked=true;
        }
        }
                        </script>

                    </table>
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
